///useScrollPostion用来监测浏览器页面的滚动情况
import { ref } from 'vue'
export default function () {
  const scrollX = ref(0)
  const scrollY = ref(0)
  const clientW = ref(0)
  const clientH = ref(0)
  window.addEventListener('scroll', () => {
    scrollX.value = window.screenX.toFixed(0)
    scrollY.value = window.screenY.toFixed(0)
  })
 //侦听器resize事件
  window.addEventListener("resize", ()=>{
  	clientW.value = document.documentElement.clientWidth;
  	clientH.value = document.documentElement.clientHeight;
  });

  return { scrollX, scrollY, clientW, clientH }
}